#ifndef								__QTASYNCTCPSOCKET_H__
#define								__QTASYNCTCPSOCKET_H__

#include							<QtNetwork/QTcpSocket>
#include							<QObject>
#include							<QDebug>
#include							"byte.h"
#include							"ASocket.h"
#include							"processor.h"

class								QtAsyncTcpSocket : public ASocket
{
	Q_OBJECT
private:
	QTcpSocket						_socket;
	QHostAddress					_ip;

public:
	QtAsyncTcpSocket();
	~QtAsyncTcpSocket();

private:
	virtual void					_receiveTcp(size_t);

public:
	virtual void					init();
	virtual void					close();
	virtual void					connectToHost(const std::string &, const std::string &);
	virtual void					sendPacket(Packet *);
	virtual QHostAddress			getIp() const;

private slots:
	void							handleRead();
	void							handleConnect();
	void							handleDisconnect();

signals:
	void							connected(QHostAddress &);
	void							disconnected(QHostAddress &);
};

#endif								//!__QTASYNCTCPSOCKET_H__